using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using au.Swindles.LoanDataService.ObjectLayer;
using au.Swindles.LoanDataService.BLLayer;
using System.Collections.Generic;

namespace au.Swindles.LoanDataService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://au.Swindles.LoanDataService/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service : System.Web.Services.WebService
    {

    
       [WebMethod]
        public Application getLoanApplication(int pApplicationID)
        {
            Application app = null;
            try
            {
                app = BLApplication.getLoanApplication(pApplicationID);
            }
            catch (Exception)
            {
            }
            return app;
        }

       [WebMethod]
       public List<Application> getCustomerLoanApplication(int pCustomerID)
       {
           try
           {
               return BLApplication.getCustomerLoanApplication(pCustomerID);
           }
           catch (Exception)
           {
           }
           return null;
       }

       [WebMethod]
       public List<Application> getPendingLoanApprovalList(string pLastApplicationSts)
       {
           Application app = null;
           try
           {
              return BLApplication.getPendingLoanApproval(pLastApplicationSts);
           }
           catch (Exception)
           {
           }
           return null;
       }

       [WebMethod]
       public int createLoanApplication(string pQuoteNumber, string pCustomerNumber, int pApplicationID, decimal pAssetValue, decimal pAnnualIncome, decimal pAnnualExpense, string pApplicationStatus, DateTime pStatusUpdateDate, int pStatusUpdateUserID, string pComments)
       {
           try
           {
               Application app = BLApplication.createLoanApplication(pQuoteNumber, pCustomerNumber, pApplicationID, pAssetValue, pAnnualIncome, pAnnualExpense, pApplicationStatus, pStatusUpdateDate, pStatusUpdateUserID, pComments);
               return app.ApplicationID;
           }
           catch (Exception)
           {
               return 0;
           }
       }
        [WebMethod]
        public bool updateLoanApplication(Application pApplication)
        {
            try
            {
                return BLApplication.updateLoanApplication(pApplication);
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
